package multithread;

import io.netty.util.concurrent.DefaultThreadFactory;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Author: zhangrongqing
 * @Date: 2019/12/19 16:13
 */
public class ThreadNameDemo {
    public static void main(String[] args) {
        ExecutorService executorService = new ThreadPoolExecutor(5,5,0
                , TimeUnit.SECONDS,new ArrayBlockingQueue<>(10),new DefaultThreadFactory(ThreadLocalDemo.class.getName()));

        for (int i = 0; i < 10; i++) {
            executorService.execute(new Runnable() {
                @Override
                public void run() {
                    System.out.println(Thread.currentThread().getName());
                }
            });
        }

    }
}
